home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / editors / TurboText / Rexx / TTX_ErrorParse.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-12-24  |  2.4 KB  |  110 lines

  1. /*
  2. **      $Id: TTX_ErrorParse.rexx,v 30.0 1994/06/10 18:06:17 dice Exp $
  3. **
  4. **      DICE Error Parsing Script.  Script for Oxxi TurboText (tm).
  5. **
  6. **  Notes: This assumes that your DCC:Config/DCC.Config file contains the
  7. **         following line:
  8. **  cmd= rx DCC:Rexx/TTX_ErrorParse.rexx %e "%c" "%f" "%0"
  9. */
  10.  
  11. OPTIONS RESULTS
  12.  
  13. PARSE ARG EFile '"' Fn '" "' CurDir '" "' CFile '" "' VPort '"'
  14. IF VPort = '?' THEN VPort = ''
  15.  
  16. portname = 'DICE_ERROR_PARSER'  /* DICEHelp's port name */
  17.  
  18. if ~show('p',portname) then
  19.    do
  20.       address COMMAND 'RUN >NIL: <NIL: DError REXXSTARTUP'
  21.  
  22.       do i = 1 to 6
  23.          if ~show('p',portname) then
  24.             address COMMAND 'wait 1'
  25.       end
  26.  
  27.       if ~show('p',portname) then
  28.          do
  29.             say "Dice Error Parser (DERROR) program not found!"
  30.             address COMMAND 'type' EFile
  31.             exit
  32.          end
  33.    end
  34.  
  35. /**
  36.  ** Get the error messages loaded in.
  37.  ** This will return a list of lines within the file that have
  38.  ** errors associated with them (if any)
  39.  **/
  40. ADDRESS DICE_ERROR_PARSER LOAD EFile '"'CurDir'" "'Fn'" "'VPort'"'
  41. LINES = RESULT
  42.  
  43. /**
  44.  ** Go through and set bookmarks on the original line numbers
  45.  **/
  46. IF LINES ~= '' & CFile ~= '' THEN
  47.    DO
  48.  
  49.       ADDRESS DICE_ERROR_PARSER 'TTXSAME "'CFile'" "'VPort'"'
  50.       EPort = RESULT
  51.       IF RC ~= 0 THEN
  52.          DO
  53.             SAY 'Unable to open file' CFile 'for editing'
  54.             exit
  55.          END
  56.  
  57.       ADDRESS VALUE EPort
  58.  
  59.       'SetDisplayLock ON'
  60.       DO I = 1 to WORDS(LINES)
  61.          L = word(LINES, I)
  62.          'Move FOLDS' L 1
  63.          'SetBookMark' 1000+L
  64.       END
  65.       'SetDisplayLock OFF'
  66.    END
  67.  
  68.  
  69. /**
  70.  ** Lastly, go to the first error message
  71.  **/
  72.  
  73. ADDRESS DICE_ERROR_PARSER Current E
  74. IF rc ~= 0 THEN
  75.    DO
  76.       'SetStatusBar No More Errors'
  77.       exit 0
  78.    END
  79.  
  80. IF E.LINE = 0 THEN
  81.    DO
  82.    IF LEFT(E.TEXT, 5) = 'DLINK' THEN
  83.       DO
  84.          TT = TRANSLATE(E.STRING, '-', '"')
  85.          /* This is a DLINK error, we need to handle it special */
  86.          SAY 'There were DLINK Errors'
  87.          ADDRESS COMMAND TYPE EFILE
  88.          exit 0
  89.       END
  90.    END
  91.  
  92. ADDRESS DICE_ERROR_PARSER 'TTXSAME "'E.FPATH'" "'E.ARGS'"'
  93. IF RC ~= 0 THEN
  94.    DO
  95.       Say 'Unable to open' E.FPATH
  96.       exit 0
  97.    END
  98.  
  99. Port = RESULT
  100. ADDRESS Value Port
  101. 'MoveBookMark' 1000+E.line
  102. IF RC = 0 THEN
  103. DO
  104.    'GetCursorPos'
  105.    E.Line = word(result, 1)
  106. END
  107. 'Move FOLDS' E.Line E.Col
  108.  
  109. 'SetStatusBar' E.STRING
  110.